package com.globalwave.pos.inventory.entity;

import com.globalwave.product.entity.Product;

public class ProductItem extends Product {

	private Boolean isBefore = null ;
	private float percentage = 1 ;


	public void setDateNow(Long dateNow){
		isBefore = dateNow.longValue() < this.getUntil_date_time().longValue() ;
	}
	
	public void setPercentage(float percentage) {
		this.percentage = percentage ;
	}
	
	// -------------------
	public Double getOriginal_price() {
		if (isBefore == null) return null ;
		return isBefore.booleanValue()?getPre_original_price():getPost_original_price();
	}
	public Double getDiscount_price() {
		if (isBefore == null) return null ;
		return (isBefore.booleanValue()?getPre_discount_price():getPost_discount_price()) * percentage;
	}
	public Double getPrice1() {
		if (isBefore == null) return null ;
		return isBefore.booleanValue()?getPre_price1():getPost_price1();
	}
	public Double getPrice2() {
		if (isBefore == null) return null ;
		return isBefore.booleanValue()?getPre_price2():getPost_price2();
	}
	public Double getNation_tax() {
		if (isBefore == null) return null ;
		return isBefore.booleanValue()?getPre_nation_tax():getPost_nation_tax();
	}
	public Double getLocation_tax() {
		if (isBefore == null) return null ;
		return isBefore.booleanValue()?getPre_location_tax():getPost_location_tax();
	}
	public String getCurrency_code() {
		if (isBefore == null) return null ;
		return isBefore.booleanValue()?getPre_currency_code():getPost_currency_code();
	}
	public Short getSalable_status() {
		if (isBefore == null) return null ;
		return isBefore.booleanValue()?getPre_salable_status():getPost_salable_status();
	}	
}
